//
//  HttpDemand.swift
//  KTDouYu
//
//  Created by ly on 16/5/10.
//  Copyright © 2016年 CoolKi. All rights reserved.
//

import UIKit
import MJExtension

class HttpDemand: NSObject {
    //全部界面的网络请求
    class func completeLoadData(itmeBlack : (array : [AnyObject]) -> ()) {
        
        let url = "http://www.douyutv.com/api/v1/live"
        let parameters = [
            "aid":"ios",
            "auth":"b317487532542c2f8200f374f3153da2",
            "client_sys":"ios",
            "limit":"20"
        ]
        KTHttpTool.shareInstance.KT_GET(url, parameters: parameters, success: { (dataTask, response) -> () in
            guard let response = response else {
                return
            }
            let dataDic = response as! [String : AnyObject]
            let array = dataDic["data"]
            let itmeArray = DetailsItme.mj_objectArrayWithKeyValuesArray(array) as [AnyObject]
            //刷新tableView
            itmeBlack(array: itmeArray)
            }) { (dataTask, error) -> () in
                print(error)
        }
        
    }

}
